#ifndef WIDGET_LISTENER_H
#define WIDGET_LISTENER_H



#include "gui.h"



/** @brief Class representating line with connected player info
*
*   \image html widget_listener.jpeg
*/
class connected_player: public QWidget
{

public:

	/** @brief Constructor creates the block with client information
	*	@param c client number
	*	@param parent Qt parent
	*	@param flags Qt flags
	*/
	connected_player( unsigned int c, QWidget* parent = 0, Qt::WindowFlags flags = 0 );

	/** @brief Sets client's status
	*	@param s client's status
	*/
	void set_status( const string& s );
	/** @brief Sets client's name and type
	*	@param n client's name
	*	@param t client's type
	*/
	void set_name( const string& n, const string& t );
	/** @brief Sets client's error message
	*	@param e client's error message
	*/
	void set_error( const string& e );

	//! Client number
	unsigned int clinet_id;


private:

	//! Client name and type label
	QLabel* name_l;
	//! Client status
	QLabel* status_l;
	//! Client errors label
	QLabel* error_l;

};



/** @brief Gui class for viewing listener clients information
*
*   \image html widget_listener.jpeg
*/
class listener_widget: public QWidget
{

	Q_OBJECT

public:

	/** @brief Creates part of the gui
	*	@param parent Qt parent
	*	@param flags Qt flags
	*/
	listener_widget( QWidget* parent = 0, Qt::WindowFlags flags = 0 );

	/** @brief Shows listener status message
	*	@param s status message
	*/
	void show_status( const string& s );

	//! widget representating one player's connection and shows status and some info of this connection
	connected_player** connected_players;
	

private:

	//! widget layout
	QVBoxLayout* layout;
	//! restart button
	QPushButton* restart_b;
	//! listener status label
	QLabel* status_l;


private slots:

	//! @brief Qt slot for restarting server listener
	void restart_listener();
	
};



#endif